package com.kexuexiong.demo.bear.elasticsearch.model;

import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import nonapi.io.github.classgraph.json.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;

import java.io.Serializable;
import java.util.List;

@Document(indexName = "person")
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class Person implements Serializable {

    private static final long serialVersionUID = 1L;

    @Id
    private String id;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", index = true)
    private String userName;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", index = true)
    private String password;

    private Integer level;

    @Field(type = FieldType.Text, analyzer = "ik_max_word", index = true)
    private String content;

    @Field(type = FieldType.Keyword)
    private List<String> roles;

}
